home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / ADA / GNAT / !gcc / adainc / 4 / ads / i-os2lib < prev    next >
Text File  |  1996-02-12  |  6KB  |  123 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT COMPILER COMPONENTS                         --
  4. --                                                                          --
  5. --                     I N T E R F A C E S . O S 2 L I B                    --
  6. --                                                                          --
  7. --                                  S p e c                                 --
  8. --                                                                          --
  9. --                             $Revision: 1.9 $                             --
  10. --                                                                          --
  11. --        Copyright (C) 1993,1994,1995 Free Software Foundation, Inc.       --
  12. --                                                                          --
  13. -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  14. -- terms of the  GNU General Public License as published  by the Free Soft- --
  15. -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
  16. -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
  17. -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  18. -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
  19. -- for  more details.  You should have  received  a copy of the GNU General --
  20. -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
  21. -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
  22. -- MA 02111-1307, USA.                                                      --
  23. --                                                                          --
  24. -- As a special exception,  if other files  instantiate  generics from this --
  25. -- unit, or you link  this unit with other files  to produce an executable, --
  26. -- this  unit  does not  by itself cause  the resulting  executable  to  be --
  27. -- covered  by the  GNU  General  Public  License.  This exception does not --
  28. -- however invalidate  any other reasons why  the executable file  might be --
  29. -- covered by the  GNU Public License.                                      --
  30. --                                                                          --
  31. -- GNAT was originally developed  by the GNAT team at  New York University. --
  32. -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
  33. --                                                                          --
  34. ------------------------------------------------------------------------------
  35.  
  36. --  This package (and children) provide interface definitions to the standard
  37. --  OS/2 Library. They are merely a translation of the various <bse*.h> files.
  38.  
  39. --  It is intended that higher level interfaces (with better names, and
  40. --  stronger typing!) be built on top of this one for Ada (i.e. clean)
  41. --  programming.
  42.  
  43. --  We have chosen to keep names, types, etc.  as close as possible to the
  44. --  C definition to provide easier reference to the documentation. The main
  45. --  exception is when a formal and its type (in C) differed only by the case
  46. --  of letters (like in HMUX hmux). In this case, we have prepended "F_" to
  47. --  the formal (i.e. F_hmux : HMUX).
  48.  
  49. with Interfaces.C;
  50. with Interfaces.C.Strings;
  51.  
  52. package Interfaces.OS2Lib is
  53. pragma Preelaborate (OS2Lib);
  54.  
  55.    package IC  renames Interfaces.C;
  56.    package ICS renames Interfaces.C.Strings;
  57.  
  58.    -------------------
  59.    -- General Types --
  60.    -------------------
  61.  
  62.    type    APIRET   is new IC.unsigned_long;
  63.    type    APIRET16 is new IC.unsigned_short;
  64.    subtype APIRET32 is     APIRET;
  65.  
  66.    subtype PSZ   is ICS.chars_ptr;
  67.    subtype PCHAR is ICS.chars_ptr;
  68.    subtype PVOID is System.Address;
  69.  
  70.    type BOOL32 is new IC.unsigned_long;
  71.    False32 : constant BOOL32 := 0;
  72.    True32  : constant BOOL32 := 1;
  73.  
  74.    type UCHAR  is new IC.unsigned_char;
  75.    type USHORT is new IC.unsigned_short;
  76.    type ULONG  is new IC.unsigned_long;
  77.    type PULONG is access all ULONG;
  78.  
  79.    ---------------------
  80.    -- Time Manegement --
  81.    ---------------------
  82.  
  83.    procedure DosSleep (How_long : IC.int);
  84.    pragma Import (C, DosSleep, External_Name => "DosSleep");
  85.  
  86.    type DATETIME is
  87.       record
  88.            hours      : UCHAR;
  89.            minutes    : UCHAR;
  90.            seconds    : UCHAR;
  91.            hundredths : UCHAR;
  92.            day        : UCHAR;
  93.            month      : UCHAR;
  94.            year       : USHORT;
  95.            timezone   : IC.short;
  96.            weekday    : UCHAR;
  97.       end record;
  98.  
  99.    type PDATETIME is access all DATETIME;
  100.  
  101.    function DosGetDateTime (pdt : PDATETIME) return APIRET;
  102.    pragma Import (C, DosGetDateTime, External_Name => "DosGetDateTime");
  103.  
  104.    function DosSetDateTime (pdt : PDATETIME) return APIRET;
  105.    pragma Import (C, DosSetDateTime, External_Name => "DosSetDateTime");
  106.  
  107.    ----------------------------
  108.    -- Miscelleneous Features --
  109.    ----------------------------
  110.  
  111.    --  Features which do not fit any child
  112.  
  113.    function DosBeep (Freq : ULONG; Dur : ULONG) return APIRET;
  114.    pragma Import (C, DosBeep, External_Name => "DosBeep");
  115.  
  116.    procedure Must_Not_Fail (Return_Code : OS2Lib.APIRET);
  117.    --  Many OS/2 functions return APIRET and are not supposed to fail. In C
  118.    --  style, these would be called as procedures, disregarding the returned
  119.    --  value. This procedure can be used to achieve the same effect with a
  120.    --  call of the form: Must_Not_Fail (Some_OS2_Function (...));
  121.  
  122. end Interfaces.OS2Lib;
  123.